const cp = require('child_process')
const fs = require('fs')
let out = fs.openSync('./demo.txt', 'a')
const sp = cp.spawn('node', ['write.js'], {
  detached: true,
  stdio: ['ignore', out, 'ignore']
})
sp.on('data', function (data) {
  console.log(data.toSting());
})
sp.unref()